package com.sh.service.impl;

import com.sh.service.FileServiceBiz;
import com.sh.utils.AliOssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.concurrent.CompletableFuture;

@Service
public class FileServiceImpl implements FileServiceBiz {

    @Autowired
    private AliOssUtil aliOssUtil;


    @Override
    public String upload(byte[] bytes, String objectName) {
            return aliOssUtil.upload(bytes, objectName);
    }

    @Async
    @Override
    public CompletableFuture<String> upload(MultipartFile file) {
        return aliOssUtil.upload(file);
    }

    @Override
    public List<String> upload(List<MultipartFile> files) {
        return aliOssUtil.upload(files);
    }
}
